<div id="content" class="gallery">
	<p class="title"><?php echo $title; ?></p>
	<p class="info"><?php echo lang('gallery_size', $total); ?><?php if($total): ?><span class="right normal"><?php echo lang('page_index', array('index'=>$page, 'total'=>$pages)); ?></span><?php endif; ?></p>
	<?php if($total): ?>
	<div id="selection">
		<a href="<?php echo WEB.sprintf($format, 'new', $range, 1); ?>" class="button enabled left<?php if($order == 'new'): ?> current<?php endif; ?>"><?php echo lang('new'); ?></a>
		<a href="<?php echo WEB.sprintf($format, 'popular', $range, 1); ?>" class="button enabled left<?php if($order == 'popular'): ?> current<?php endif; ?>"><?php echo lang('popular'); ?></a>
		<a href="<?php echo WEB.sprintf($format, $order, 'all', 1); ?>" class="button enabled right<?php if($range == 'all'): ?> current<?php endif; ?>"><?php echo lang('all_time'); ?></a>
		<?php if($month[0]): ?>
		<a href="<?php echo WEB.sprintf($format, $order, 'month', 1); ?>" class="button enabled right<?php if($range == 'month'): ?> current<?php endif; ?>"><?php echo lang('month'); ?></a>
		<?php if($week[0]): ?>
		<a href="<?php echo WEB.sprintf($format, $order, 'week', 1); ?>" class="button enabled right<?php if($range == 'week'): ?> current<?php endif; ?>"><?php echo lang('week'); ?></a>
		<?php endif; ?>
		<?php if($today[0]): ?>
		<a href="<?php echo WEB.sprintf($format, $order, 'today', 1); ?>" class="button enabled right<?php if($range == 'today'): ?> current<?php endif; ?>"><?php echo lang('today'); ?></a>
		<?php endif; ?>
		<?php endif; ?>
		<div class="clear"><!-- --></div>
	</div>
	<?php while($image = $images->fetch($i)): ?>
	<div class="image<?php if($i%5 === 0): ?> right<?php endif; ?>">
		<a href="<?php echo WEB.$image->alpha(); ?>/">
			<?php $image->output('square'); ?>
		</a>
	</div>
	<?php endwhile; ?>
	<div class="clear"><!-- --></div>
	<div id="pagination">
		<?php if($page != 1): ?>
		<a href="<?php echo WEB.sprintf($format, $order, $range, $page - 1); ?>" class="button enabled left"><?php echo lang('previous'); ?></a>
		<a href="<?php echo WEB.sprintf($format, $order, $range, 1); ?>" class="button enabled left"><?php echo lang('first'); ?></a>
		<?php else: ?>
		<a class="button left"><?php echo lang('previous'); ?></a>
		<a class="button left"><?php echo lang('first'); ?></a>
		<?php endif; ?>
		<?php for($i=$min; $i<=$max; $i++): ?>
		<a <?php if($i != $page): ?>href="<?php echo WEB.sprintf($format, $order, $range, $i); ?>"<?php endif; ?>class="button <?php if($i == $page): ?>current<?php else: ?>enabled<?php endif; ?>"><?php echo $i; ?></a>
		<?php endfor; ?>
		<?php if($page != $pages): ?>
		<a href="<?php echo WEB.sprintf($format, $order, $range, $page + 1); ?>" class="button enabled right"><?php echo lang('next'); ?></a>
		<a href="<?php echo WEB.sprintf($format, $order, $range, $pages); ?>" class="button enabled right"><?php echo lang('last'); ?></a>
		<?php else: ?>
		<a class="button right"><?php echo lang('next'); ?></a>
		<a class="button right"><?php echo lang('last'); ?></a>
		<?php endif; ?>
	</div>
	<?php endif; ?>
</div>